package tech.aistar.day13;

import java.io.*;

/**
 * 本类用来演示: 文件拷贝
 *
 * @author: success
 * @date: 2021/3/25 9:09 上午
 */
public class ReaderWriterFileCopyDemo {
    public static void main(String[] args) {
        try(BufferedReader in = new BufferedReader(new FileReader("src/tech/aistar/day13/print.txt"));
            PrintWriter out = new PrintWriter(new FileWriter("src/tech/aistar/day13/print_copy.txt"),true)) {

            //循环读取和写入
            String line = null;
            while((line = in.readLine())!=null){
                out.println(line);
            }
            System.out.println("拷贝成功");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
